// template/tabBarTemplate/tabBarTemplate.js

//初始化数据
function tabbarinit() {
  return [
    {
      "current": 0,
      "pagePath": "/pages/index/index",
      "iconPath": "/images/tabbar_icon1.png",
      "selectedIconPath": "/images/tabbar_icon1_cur.png",
      "title":"首页"
    },
    {
      "current": 0,
      "pagePath": "/pages/classification/classification",
      "iconPath": "/images/tabbar_icon4.png",
      "selectedIconPath": "/images/tabbar_icon4_cur.png",
      "title": "分类"
    },
    {
      "current": 0,
      "pagePath": "/pages/shoppingCart/shoppingCart",
      "iconPath": "/images/tabbar_icon2.png",
      "selectedIconPath": "/images/tabbar_icon2_cur.png",
      "title": "购物车"
    },
    {
      "current": 0,
      "pagePath": "/pages/personalCenter/personalCenter",
      "iconPath": "/images/tabbar_icon3.png",
      "selectedIconPath": "/images/tabbar_icon3_cur.png",
      "title": "我的"
    }
  ]

}
//tabbar 主入口
function tabbarmain(bindName = "tabdata", id, target) {
  var that = target;
  var bindData = {};
  var otabbar = tabbarinit();
  otabbar[id]['iconPath'] = otabbar[id]['selectedIconPath']//换当前的icon
  otabbar[id]['current'] = 1;
  bindData[bindName] = otabbar
  that.setData({ bindData });
}

module.exports = {
  tabbar: tabbarmain
}